package com.zc.study.rubbitmq.eg2;

import java.io.IOException;
import java.util.HashMap;

/**
 * @author  作者 ucs_fuqing
 * @date 创建时间：2017年8月11日 下午2:44:59
 * @version 1.0
 * @parameter
 * @since
 * @return
 */
public class Run {
    public Run() throws IOException{
        QueueConsumer consumer = new QueueConsumer("testqueue");
        QueueConsumer2 consumer2 = new QueueConsumer2("testqueue");
        Thread cuThread = new Thread(consumer);
        Thread cuThread2 = new Thread(consumer2);
        cuThread.start();
        cuThread2.start();
        Producer producer = new Producer("testqueue");
        int i = 0;
        while (i<10) {
            HashMap<String, Object> hm = new HashMap<>();
            hm.put("tagId", i);
            producer.sendMessage(hm);
            System.out.println("发送第"+i+"消息");
            i++;
        }
    }

    public static void main(String[] args) throws IOException {
        new Run();
    }
}